package cn.tedu.collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class SortListDemo1 {
    public static void main(String[] args) {
       List<Integer> list = new ArrayList<>();
       Random random = new Random();
       for (int i=0;i<10;i++){
           list.add(random.nextInt(100));
       }
        System.out.println(list);
       Collections.sort(list);
        System.out.println("从小到大自然排序:"+list);
        Collections.shuffle(list);
        System.out.println("打乱顺序排序:"+list);
        Collections.sort(list,(p1,p2)->p2-p1);
        System.out.println("从大到小排序:"+list);
    }
}
